using System;
using CustomControls;
using System.Xml.Linq;
using System.Custom.Window;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace CoreTypes
{
   public interface IMediaSession : ICommunicationServiceObject, ICommunicationEventHanldlerObject
   {
      object Tag
      {
         get;
         set;
      }
      string Name
      {
         get;
         set;
      }
      string Gsid
      {
         get;
         set;
      }
      bool IsActive
      {
         get;
      }
      string JoinKey
      {
         get;
         set;
      }
      string Subject
      {
         get;
         set;
      }
      string Caption
      {
         get;
      }
      int IdleTimeout
      {
         get;
         set;
      }
      Account Account
      {
         get;
         set;
      }
      bool IsPersonal
      {
         get;
      }
      User SessionOwner
      {
         get;
      }
      XElement XObject
      {
         get;
         set;
      }
      bool RemoveOnIdle
      {
         get;
         set;
      }
      bool IsEstablished
      {
         get;
      }
      SessionState State
      {
         get;
      }
      Contact Interlocutor
      {
         get;
      }
      int ParticipantsLimit
      {
         get;
         set;
      }
      string InvitationText
      {
         get;
         set;
      }
      string RecipientsNames
      {
         get;
      }
      SessionSubtype Subtype
      {
         get;
      }
      IList<User> Recipients
      {
         get;
      }
      bool IsVisibleAndActive
      {
         get;
      }
      IList<User> Participants
      {
         get;
      }
      Collection<User> Invitees
      {
         get;
      }
      SessionVisibility Visibility
      {
         get;
         set;
      }
      SessionJoinFilter JoinFilter
      {
         get;
         set;
      }
      ServiceSession HostingSession
      {
         get;
         set;
      }
      ISessionVisualizer Visualizer
      {
         get;
      }
      ServiceMessage LastOutgoingMessage
      {
         get;
      }
      ServiceMessage LastIncomingMessage
      {
         get;
      }

      void Show();
      void Hide();
      void Start();
      void Close();
      void Activate();
      void Shutdown();
      void SelectAll();
      void CleanupMedia();
      void InitializeMedia();
      void Deselect(User user);
      void BlockUser(User user);
      bool IsInvited(User user);
      bool IsSelected(User user);
      void UnblockUser(User user);
      void RemoveAllParticipants();
      bool IsParticipant(User user);
      bool NeedInvitation(User user);
      User GetParticipant(string id);
      void RemoveParticipant(User user);
      void Select(User user, bool exclusive);
      bool AddParticipant(User user, bool show);

      event EventHandler Closed;
      event EventHandler Activated;
      event EventHandler<CancelEventArgs> Closing;
      event PropertyChangedEventHandler ParamsChanged;
      event EventHandler<ParticipantsChangedEventArgs> ParticipantsChanged;

      void FireActivatedEvent();
      void FireParamsChangedEvent(string name);
      void FireParticipantsChangedEvent(ParticipantsChangedEventArgs args);
   }

   public interface ISessionVisualizer : IVisualRegion
   {
      bool ParamsEnabled
      {
         get;
         set;
      }
      IMediaWindow MediaWindow
      {
         get;
         set;
      }

      IMediaSession Session
      {
         get;
         set;
      }
      string SessionCaption
      {
         get;
         set;
      }
      string SessionSubject
      {
         get;
         set;
      }
      string SessionTypeTag
      {
         get;
      }
      string SessionDescription
      {
         get;
         set;
      }
      string SessionFullTypeTag
      {
         get;
      }

      Type SessionType
      {
         get;
         set;
      }
      string SessionHost
      {
         get;
         set;
      }
      int SessionIdleTimeout
      {
         get;
         set;
      }
      bool SessionRemoveOnIdle
      {
         get;
         set;
      }
      IItemView SessionUsers
      {
         get;
      }
      int SessionParticipantsLimit
      {
         get;
         set;
      }
      string SessionInvitationText
      {
         get;
         set;
      }
      SessionSubtype SessionSubtype
      {
         get;
         set;
      }
      IItemView AccountContacts
      {
         get;
      }
      SessionVisibility SessionVisibility
      {
         get;
         set;
      }
      SessionJoinFilter SessionJoinFilter
      {
         get;
         set;
      }
      SessionHostingType SessionHostingType
      {
         get;
         set;
      }

      void ClearView();
      void RefreshView();
      void ShowMainPage();
      void ShowStartPage(bool settings);
      void ShowSessionParams(IMediaSession session, bool settings);

      event EventHandler ApplyPressed;
   }
}